
cc.Class({
    extends: cc.Component,

    properties: {
       infoPrefab :  {
            default:null,
            type : cc.Prefab,
       },

       breakPrefab:{
            default:null,
            type : cc.Prefab,
       },

       topshow :{
            default : null,
            type : cc.Node,
       }
    },

    grandButtonClick : function(event) {
        var tgnode = event.target;       
        var tgnodename = tgnode.name;
        var topshow = this.topshow;      

        if(topshow.childrenCount > 0) {     //点击到其他节点的时候清除另一个节点的按钮
            for(var i = topshow.childrenCount - 1; i >= 0; i--) {
                topshow.children[i].destroy();
            }
        }

        var basePosition = tgnode.convertToWorldSpaceAR(cc.v2(0, 0));
        var localPosition = topshow.parent.convertToNodeSpaceAR(basePosition);

        var node1 = cc.instantiate(this.infoPrefab)
        var node2 = cc.instantiate(this.breakPrefab)
           
        node2.x = localPosition.x+105
        node2.y = localPosition.y
        node1.x = node2.x-70
        node1.y = node2.y
        topshow.addChild(node1)
        topshow.addChild(node2)
        
        
        cc.vv.currentDiamond.name = event.target.name
        
       
        
        
    
    },

   

    // onLoad () {},

    start () {

    },

    // update (dt) {},
});


